<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('games', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('游戏');

            $table->id();
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->integer('game_id')->comment('游戏id')->unsigned()->default(0);
            $table->string('game_name', 32)->comment('游戏名称')->default('');
            $table->tinyInteger('is_test')->comment('是否测试状态')->unsigned()->default(0);
            $table->char('appkey', 32)->comment('appkey')->default('');
            $table->char('appsecret', 32)->comment('appsecret')->default('');
            $table->char('callback_url_test', 255)->comment('充值回调地址-测试')->default('');
            $table->char('callback_url', 255)->comment('充值回调地址')->default('');
            $table->tinyInteger('can_login')->comment('能否登录')->unsigned()->default(1);
            $table->tinyInteger('can_pay')->comment('能否支付')->unsigned()->default(1);
            $table->integer('project_id')->comment('项目id')->unsigned()->default(0);

            $table->unique('game_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('games');
    }
};
